var t = function(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}(require("../../utils/api2"));

Component({
    properties: {
        isInitbar: {
            type: Boolean,
            value: !1,
            observer: function(t) {
                this.setData({
                    isinitbar: t
                });
            }
        },
        isShown: {
            type: Boolean,
            value: !1,
            observer: function(t) {
                this.setData({
                    isshown: t
                });
            }
        },
        agentid: {
            type: Number,
            observer: function(t) {
                t && (this.setData({
                    agentid: t
                }), this.getAgentInfo(t));
            }
        },
        agentapp: {
            type: String,
            value: "site",
            observer: function(t) {
                this.setData({
                    agentapp: t
                });
            }
        }
    },
    data: {
        isInitbar: !1,
        isShown: !1,
        isAgentCreat: !1,
        isShownDialog: !1,
        agentid: 2,
        agentapp: "site"
    },
    methods: {
        create: function() {
            wx.navigateTo({
                url: "/pages/common/miniweb/introduction/introduction"
            });
        },
        getAgentInfo: function(e) {
            var a = this, n = this.data.agentapp;
            (!getApp().globalData.tokens.accesstoken || "site" === n && 2 != +e || "xmp" === n) && t.default["site" === n ? "site" : "minicard"].agent.getcompanyinfo({
                data: {
                    agentid: e,
                    from: "site"
                }
            }).then(function(t) {
                a.setData({
                    isAgentCreat: 2 !== e,
                    agent: t
                });
            });
        },
        toggleAgentDialog: function() {
            var t = this.data.isShownDialog;
            this.setData({
                isShownDialog: !t
            });
        },
        makePhoneCall: function() {
            var t = this.data.agent.mobile;
            t && wx.makePhoneCall({
                phoneNumber: t
            });
        }
    }
});